package gdut.imis.controller;

import gdut.imis.Utils.Constants;
import gdut.imis.Utils.Result;
import gdut.imis.domain.CollegeEntranceExaminationFile;
import gdut.imis.enums.Status;
import gdut.imis.service.CollegeEntranceExaminationFileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;

/**
 * @Description
 * @Author JiaFu
 * @Date 2023/4/7 15:51
 */
@RestController
@RequestMapping("/college-entrance-examination-file")
@Api(value = "学生高考成绩档案接口", tags = {"学生高考成绩档案接口"})
@RequiredArgsConstructor
public class CollegeEntranceExaminationFileController extends BaseController {
    private final CollegeEntranceExaminationFileService collegeEntranceExaminationFileService;

    @ApiOperation("新增学生高考成绩档案")
    @PostMapping("/add")
    public Result add(@RequestBody CollegeEntranceExaminationFile collegeEntranceExaminationFile) {
        collegeEntranceExaminationFileService.save(collegeEntranceExaminationFile);
        return success();
    }

    @ApiOperation("获取学生高考成绩档案列表")
    @GetMapping("/get")
    public Result get() {
        List<CollegeEntranceExaminationFile> list = collegeEntranceExaminationFileService.list();
        HashMap<String, Object> map = new HashMap<>();
        map.put(Constants.DATA_LIST, list);
        map.put(Constants.STATUS, Status.SUCCESS);
        return resturnDataList(map);
    }
}
